package nyx.service.reader;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import nyx.dao.reader.ReaderMapper;
import nyx.dao.record.RecordMapper;
import nyx.pojo.Reader;


@Service("readerService")
public class ReaderServiceImpl implements ReaderService {

	@Autowired
	private ReaderMapper raderMapper;
	@Autowired
	private RecordMapper recordmapper;
	
	
	
	
	@Override
	public Reader login(String account, String password) {
		Reader reader = null;
		reader = raderMapper.queryReader(account, password);
		if(reader == null){
			return null;
		}
		
		reader.setBorrowCount(recordmapper.queryCountByRId(reader.getrId()));
		return reader;
		
	}

}
